<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let music = {
            name:'周杰伦-七里香',
            release:2007,
            level:50,
            lyric:'窗外的麻雀',
            choose:function (song){
                console.log(`你想听周杰伦的${song}`);
            }
        }
        console.log(music);

        // 1.获取对象属性的两种方式
        // 对象名.属性名
        // 对象名[字符串] 字符串是属性名
        console.log(music.lyric);
        console.log(music['release']);

        // 2.变量是window的属性
       let search= prompt('请输入你想要搜索的歌曲');

        // 3.widow 一般省略
        console.log(search);
        console.log(window.search);

        // 4.对象方法的调用
         let song='青花瓷';
        music.choose(song);
        
        // 5.对象可以动态的添加属性（方法）
        music.genre='流行';
        music.listen =function(){
            console.log('天青色等烟雨，而我在等你');
        }
        console.log(music.genre);
        music.listen();

        // 6.属性的修改（变量的重新赋值）
        music.name='林俊杰-修炼爱情';
        console.log(music.name);

        // 7.属性的删除delete对象名，属性名
        delete music.name;
        console.log(music);
    </script>
</body>
</html>